package com.xunshibao.tutor.common;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xunshibao.core.dao.BaseDAO;
import com.xunshibao.tutor.po.School;

@Repository
public class SchoolDaoImpl {
	private static final String LIST_UNIV_BY_PROV = "select code, name from c_school where pid=? and tp=?";
	private static final String GET_SCHOOL_BY_ID = "select code, name from c_school where code=? and tp=?";
	public List<School> getUnivByType(School.TYPE type, Integer pid) {
		return BaseDAO.queryForList(School.class, LIST_UNIV_BY_PROV, new Object[]{pid, type.value()});
	}
	
	public School getSchoolByCode(School.TYPE type, Integer code) {
		return BaseDAO.queryForObject(School.class, GET_SCHOOL_BY_ID, new Object[]{code, type.value()});
	}

}
